import Vue from "vue";
import VueI18n from "vue-i18n";
import Cookies from "js-cookie";
import elementEnLocale from "element-ui/lib/locale/lang/en"; // element-ui语言包
import elementZhLocale from "element-ui/lib/locale/lang/zh-CN"; // element-ui语言包
import enLocale from "./en";
import zhLocale from "./zh";
Vue.use(VueI18n);
const messages = {
    en: {
        // ES6扩展运算符合并对象
        ...enLocale,
        ...elementEnLocale
    },
    zh: {
        ...zhLocale,
        ...elementZhLocale
    }
};
// 结合cookie记录用户选择的语言，若无默认en
const i18n = new VueI18n({
    // set locale
    // options: en or zh
    locale: Cookies.get("language") || "zh",
    // set locale messages
    messages
});
export default i18n;
